package com.zmc.lostfound.post.vo.post;

import com.zmc.lostfound.common.valid.AddGroup;
import com.zmc.lostfound.common.valid.UpdateGroup;
import com.zmc.lostfound.common.valid.ValueIntList;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.util.List;

/**
 * @author zmc
 * @description 用户发布/修改帖子信息请求体
 */
@Data
@ApiModel("用户发布/修改帖子信息请求体")
public class PostSaveVO implements Serializable {

    private static final long serialVersionUID = 3218433381693795122L;

    /**
     * 帖子id
     */
    @ApiModelProperty("帖子id")
    @Null(message = "发布帖子: 帖子id必须为空", groups = {AddGroup.class})
    @NotNull(message = "修改帖子信息: 帖子id不能为空", groups = {UpdateGroup.class})
    @Min(value = 1, message = "修改帖子信息: 帖子id必须大于等于1", groups = {UpdateGroup.class})
    private Long id;

    /**
     * 寻物/认领帖(0:寻物，1:认领)
     */
    @ApiModelProperty("寻物/认领帖(0:寻物，1:认领)")
    @NotNull(message = "发布帖子: 帖子类型不能为空", groups = {AddGroup.class})
    @ValueIntList(values = {0, 1}, message = "帖子类型只能为0或1(0:寻物，1:认领)", groups = {AddGroup.class, UpdateGroup.class})
    private Integer type;

    /**
     * 物品类型id
     */
    @ApiModelProperty("物品类型id")
    @NotNull(message = "发布帖子: 物品类型id不能为空", groups = {AddGroup.class})
    @Min(value = 1, message = "物品类型id必须大于等于1", groups = {AddGroup.class, UpdateGroup.class})
    private Long itemTypeId;

    /**
     * 物品类型名称(冗余字段)
     */
    @ApiModelProperty("物品类型名称(冗余字段)")
    @NotBlank(message = "发布帖子: 物品类型名称不能为空", groups = {AddGroup.class})
    private String itemTypeName;

    /**
     * 标题
     */
    @ApiModelProperty("标题")
    @NotNull(message = "发布帖子: 标题不能为空", groups = {AddGroup.class})
    private String title;

    /**
     * 详情
     */
    @ApiModelProperty("详情")
    @NotNull(message = "发布帖子: 详情不能为空", groups = {AddGroup.class})
    private String detail;

    /**
     * 地点
     */
    private String address;

    /**
     * 经度
     */
    private Double longitude;

    /**
     * 纬度
     */
    private Double latitude;

    /**
     * 发帖用户id
     */
    @ApiModelProperty("发帖用户id")
    @NotNull(message = "发布帖子: 发帖用户id不能为空", groups = {AddGroup.class})
    @Min(value = 1, message = "发帖用户id必须大于等于1", groups = {AddGroup.class, UpdateGroup.class})
    private Long fromUserId;

    /**
     * 帖子图片集
     */
    @ApiModelProperty("帖子图片集")
    private List<String> imgUrlList;

}
